package com.example.service;

import com.example.mapper.MessageInfoMapper;
import com.example.model.MessageInfo;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service // Spring注解，标识这是一个Service组件
public class MessageService {

    @Resource // 依赖注入，相当于@Autowired
    private MessageInfoMapper messageInfoMapper;

    public List<MessageInfo> getList() {
        // 调用DAO层方法获取留言列表
        return messageInfoMapper.selectAll();
    }

    public Integer insertMessage(MessageInfo messageInfo) {
        // 调用DAO层方法插入留言
        return messageInfoMapper.insertMessage(messageInfo);
    }
}
